﻿using System;
using TalentRecruitmentSystem.Manage;
using System.Web.UI;
using TalentRecruitmentSystem.Service;

namespace TalentRecruitmentSystem.Pages
{
    public partial class ResumeCentre : System.Web.UI.Page
    {
        UserInfoManage um = new UserInfoManage();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["perInSession"] == null && Session["perInSession"] == "")
            {
                Response.Redirect("Back.aspx");
            }
        }

        protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
        {
            UserInfo userInfo = new UserInfo();
            //string str = Session["stringInSession"].ToString();
            string str2 = Session["perInSession"].ToString();
            if (str2 != null)
            {
                userInfo = um.getUserInfoByUserName(str2);
            }
            else
            {
                Response.Write("<script>window.alert('页面已过期，请刷新页面！');</script>");
            }
            //if (str != "")
            //{
            //    userInfo = um.getUserInfoByUserName(str);
            //}
            //else if (str2 != null)
            //{
            //    userInfo = um.getUserInfoByUserName(str2);
            //}
            userInfo.TruthName = txtName.Text;
            if (RadioButton1.Checked)
                userInfo.Gender = "男";
            else
                userInfo.Gender = "女";
            userInfo.Birthday = txtBirthday.Text;
            userInfo.MarriageStatus = DropDownList2.Text;
            userInfo.SelfNumber = txtPersonNum.Text;
            userInfo.Address = txtAddress.Text;
            userInfo.Phone = txtLink.Text;
            userInfo.Email = txtEmail.Text;
            userInfo.SchoolTag = txtSchool.Text;
            userInfo.EducationTime = DateTime.Parse(txtTime.Text);
            userInfo.Education = txtEducation.Text;
            userInfo.Languagelevel = txtLanage.Text;
            userInfo.Workexperience = txtExpri.Text;
            userInfo.Prize = txtPrize.Text;
            userInfo.Speciality = txtSpecial.Text;
            userInfo.Selfassessment = txtContent.Text;
            userInfo.Expectpositon = TextBox2.Text;
            userInfo.Workplace = TextBox1.Text;
            userInfo.Expectwages = TextBox3.Text;
            um.UpdateUserInfo(userInfo);
            Response.Write("<script>window.alert('保存成功！');</script>");
            Response.Redirect("PositionSearch.aspx?Name="+userInfo.UserName);
        }
    }
}